//
//  CYHomeNewsTitleCell.m
//  cyjf
//
//  Created by tauCross on 2017/7/6.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYHomeNewsTitleCell.h"



@interface CYHomeNewsTitleCell ()

@property(nonatomic, strong)UILabel *cellTitleLabel;
@property(nonatomic, strong)UIImageView *bottomLine;

@end


@implementation CYHomeNewsTitleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        self.cellTitleLabel = [UILabel cy_homeCellTitleLabelWithText:@"车蚁头条"];
        [self.contentView addSubview:self.cellTitleLabel];
        
        self.bottomLine = [UIImageView cy_imageLineWithColor:HEXCOLOR(@"ECECEC")];
        [self.contentView addSubview:self.bottomLine];
    }
    return self;
}

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
    return 44;
}

- (BOOL)shouldUpdateCellWithObject:(id)object
{
    [self setNeedsLayout];
    return YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.cellTitleLabel sizeToFit];
    self.cellTitleLabel.centerY = 22;
    self.cellTitleLabel.left = 20;

    self.bottomLine.width = self.contentView.width;
    self.bottomLine.height = 1 / SCREEN_SCALE;
    self.bottomLine.left = 0;
    self.bottomLine.bottom = self.contentView.height;
}

@end
